package br.com.veterinariavillage.view.Especie;

import javax.swing.table.*;
import javax.swing.*;
import javax.swing.GroupLayout.Alignment;
import javax.swing.LayoutStyle.ComponentPlacement;

@SuppressWarnings("serial")
public class TabelaEspecies extends JPanel {
    private JScrollPane spEspecie;
    private JPanel pnBotoes;
    
    public JPanel getPnBotoes() {
		return pnBotoes;
	}

	public void setPnBotoes(JPanel pnBotoes) {
		this.pnBotoes = pnBotoes;
	}

	private JTable tbEspecie;

    public TabelaEspecies() {
        inicializarComponentes();
    }

    private void inicializarComponentes() {

        spEspecie = new JScrollPane();
        tbEspecie = new JTable();

        tbEspecie.setModel(new DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Tipo"
            }
        ) {
            @SuppressWarnings("rawtypes")
			Class[] types = new Class [] {
                java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false
            };

            @SuppressWarnings({ "rawtypes", "unchecked" })
			public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        spEspecie.setViewportView(tbEspecie);
        
        pnBotoes = new BotoesTabelaEspecie();

        GroupLayout layout = new GroupLayout(this);
        layout.setHorizontalGroup(
        	layout.createParallelGroup(Alignment.LEADING)
        		.addGroup(Alignment.TRAILING, layout.createSequentialGroup()
        			.addContainerGap()
        			.addGroup(layout.createParallelGroup(Alignment.TRAILING)
        				.addComponent(pnBotoes, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 430, Short.MAX_VALUE)
        				.addComponent(spEspecie, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 430, Short.MAX_VALUE))
        			.addContainerGap())
        );
        layout.setVerticalGroup(
        	layout.createParallelGroup(Alignment.LEADING)
        		.addGroup(layout.createSequentialGroup()
        			.addGap(11)
        			.addComponent(spEspecie, GroupLayout.DEFAULT_SIZE, 237, Short.MAX_VALUE)
        			.addPreferredGap(ComponentPlacement.RELATED)
        			.addComponent(pnBotoes, GroupLayout.PREFERRED_SIZE, 46, GroupLayout.PREFERRED_SIZE))
        );
        this.setLayout(layout);
    }
}
